package gdut.imis.controller;

import gdut.imis.Utils.Result;
import gdut.imis.domain.ClubInstitutionFile;
import gdut.imis.service.ClubInstitutionFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author JiaFu
 * @Date 2023/4/7 15:24
 */
@RestController
@RequestMapping("/club-institution-file")
@Api(value = "社团机构档案接口", tags = {"社团机构档案接口"})
@RequiredArgsConstructor
public class ClubInstitutionFileController extends BaseController {
    private final ClubInstitutionFileService clubInstitutionFileService;

    @ApiOperation("新增社团机构档案")
    @PostMapping("/addClubInstitution")
    @PreAuthorize("@cp.hasPermission('clubInstitutionFile')")
    public Result addClubInstitution(@RequestBody ClubInstitutionFile clubInstitutionFile) {
        return clubInstitutionFileService.addClubInstitution(clubInstitutionFile);
    }


    @ApiOperation("根据学生id查询学生第一次加入社团的档案回忆")
    @GetMapping("/getClubInstitutionMemoryByStuId/{studentId}")
    public Result getClubInstitutionMemoryByStuId(@PathVariable("studentId") Long studentId){
        return clubInstitutionFileService.getClubInstitutionMemoryByStuId(studentId);
    }


}
